<template>
  <div style="height: 100%;">
    <el-container>
      <el-header style="margin-bottom: 1.5rem;">
        <el-row>
          <el-col :span="24">
            <div class="top">
              <el-row type="flex" justify="center" :gutter="50">
                <el-col :span="4"><div class="top-logo"><img src="../assets/img/logo.png"/></div></el-col>
                <el-col :span="12">
                  <div>
                    <el-menu :default-active="activeIndex" text-color="#ffffff" class="el-menu-demo" mode="horizontal" @select="handleSelect">
                      <el-menu-item index="1" style="background-color: #138bee;">首页</el-menu-item>
                      <el-menu-item index="2" style="background-color: #138bee;">班级</el-menu-item>
                      <el-menu-item index="3" style="background-color: #138bee;">考试</el-menu-item>
                      <el-menu-item index="4" style="background-color: #138bee;">课程</el-menu-item>
                      <el-menu-item index="5" style="background-color: #138bee;">题库</el-menu-item>
                      <el-menu-item index="6" style="background-color: #138bee;">上课</el-menu-item>
                      <el-menu-item index="7" style="background-color: #138bee;">计划进度模板</el-menu-item>
                      <el-menu-item index="8" style="background-color: #138bee;">计划进度管理</el-menu-item>
                    </el-menu>
                  </div>
                </el-col>
                <el-col :span="4">
                  <div class="top-head-left">
                    <img src="../assets/img/toxiang.png" />
                  </div>
                  <div class="top-head-right">
                    <el-dropdown size="mini">
                      <span class="el-dropdown-link">{{name}}<i class="el-icon-arrow-down el-icon--right"></i></span>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item @click.native="cancellation">退出登录</el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                  </div>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
      </el-header>
      <el-main>
        <!-- 子路由 -->
        <router-view>
        </router-view>
      </el-main>
    </el-container>
  </div>
</template>

<script>
export default {
  data () {
    return {
      activeIndex: '2',
      name: '',
      dialogFormVisible: false,
      dialogVisible: false,
      pas: {
        password: '',
        password1: '',
        code: ''
      }
    }
  },
  components: {

  },
  created () {
    this.name = localStorage.getItem('name')
  },
  methods: {
    handleSelect (index) {
      let map = new Map()
      map.set('1', 'homepage')
      map.set('2', 'classManage')
      map.set('3', 'exam')
      map.set('4', 'course')
      map.set('5', 'questionBank')
      let routeUrl = map.get(index)
      this.$router.push(routeUrl)
    }
    // home () {
    //   this.$router.push('/home')
    // },
    // homepage () {
    //   this.$router.push('/homepage')
    // },
    // exam () {
    //   this.$router.push('/exam')
    // },
    // course () {
    //   this.$router.push('/course')
    // }
  }
}
</script>

<style scoped="scoped">
 @import url("../assets/css/homepage.css");
</style>
